package com.scm.servlet.somain;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.scm.dao.SomainDao;
import com.scm.model.Somain;

/**
 * 销售单明细
 * @author Surrik_Zhang
 */
@WebServlet(urlPatterns={"/main/somain/somainDetail","/main/finance/somainDetail"})
public class SomainDetailServlet extends HttpServlet{
	private static final long serialVersionUID = 4466724586305203577L;
	private static final Logger LOGGER = Logger.getLogger(SomainDetailServlet.class);
		@Override
		protected void doGet(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {
			String soid = req.getParameter("soid");
			//查询明细
			Long soId = Long.parseLong(soid);
			try {
				Somain somain = new SomainDao().queryBySoid(soId);
				req.setAttribute("somain", somain);
				
				req.getRequestDispatcher("/main/somain/somain_detail_layer.jsp").forward(req, resp);
			} catch (SQLException e) {
				LOGGER.error("【查看销售单详情】-异常",e);
			}
			
		}
		
		@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {
			doGet(req, resp);
		}
}
